import com.sun.jdi.Method;

import java.util.Arrays;

public class OverLoadExercise {
    public static void main(String[] args) {
        Methods methods = new Methods();
        System.out.println(methods.m(20));
        System.out.println(methods.m(10, 20));
        System.out.println(methods.m("调用"));
        methods.max(10, 15);
        methods.max(10.8, 9.76);
        methods.max(10.85, 20.3, 6.54);
    }
}


class Methods {
    public int m(int a) {
        System.out.println("调用一个参数的重载方法");
        return a * a;
    }
    public int m(int a, int b) {
        System.out.println("调用两个参数的重载方法");
        return a * b;
    }
    public String m(String a) {
        System.out.println("调用String类型参数的重载方法");
        return a;
    }
    public void max(int a, int b) {
        if (a > b) {
            System.out.println("最大值为：" + a);
        } else if (a < b) {
            System.out.println("最大值为：" + b);
        } else {
            System.out.println("两个值相等");
        }
    }
    public void max(double a, double b) {
        if (a > b) {
            System.out.println("最大值为；" + a);
        } else if (a < b) {
            System.out.println("最大值为：" + b);
        } else {
            System.out.println("两个值相等");
        }
    }
    public void max(double a, double b, double c) {
        double[] maxNum = {a, b, c};
        Arrays.sort(maxNum);
        System.out.println("最大值为：" + maxNum[2]);
    }
}
